extends ../layout

block css
    link(rel='stylesheet', href='/css/base/ck_base.css', media='screen')
    link(rel='stylesheet', href='/css/user/ck_user2.css', media='screen')
    link(href='/css/pay/base.css', rel='stylesheet', type='text/css')
    link(href='/css/pay/pay.css', rel='stylesheet', type='text/css')
    style(type='text/css').
      .formItem{
      margin-left: 130px;
      }
      .n_btn28g, .n_btn24o, .n_btn24gr, .n_btn30g, .n_btn34g, .n_btn34lg_up, .n_btn34g_add, .n_btn34lg_add, .n_btn32g_, .n_btn36g, .n_btn24g, .n_btn30gr_b, .n_btn30gr_up, .n_btn30gr_swf, .n_btn34gr_b, .n_btn34lg, .n_btn36lg, .n_btn38g, .n_btn38gr_b, .n_btn30o, .n_btn36o, .n_btn38o, .n_btn40lg, .n_btn46g, .n_btn46gr {
      display: inline-block;
      color: #fff;
      text-align: center;
      }
      .n_btn38g {
      height: 38px;
      padding: 0 23px;
      font: 700 16px/38px 'simsun';
      background: #337CE0;
      }
      .fk_wrap{
      margin-top: 20px;
      }
block content

    .wrap-pay
      .bd.fk_wrap
        .deal-detail.clearfix
          .left-part
            .f16
              span Java面试那些题
            .f12.mt15
              span 交易方：宅客学院
          .right-part(style='width:455px')
            .f16.tr
              | 订单金额：
              span.f20.c_f60 10.00
              | 元
            .tr.f12.c_777.mt10
              | 请于48小时内完成订单支付，超过时间需重新下单。付款剩余时间：
              span#remainTime.c_f60 47小时50分23秒
          script(type='text/javascript').
            var remainTime = 172799; //按秒计算
            function CountDown() {
            if (remainTime > 0) {
            hours = Math.floor(remainTime / 3600);
            minutes = Math.floor(remainTime % 3600 / 60);
            seconds = Math.floor(remainTime % 3600 % 60);
            var text = "";
            if (hours > 0) {
            text = hours + "小时";
            }
            if ((hours > 0 && minutes == 0) || minutes > 0) {
            text = text + minutes + "分";
            }
            text = text + seconds + '秒';
            $("#remainTime").html(text);
            --remainTime;
            } else {
            $("#fe_window_mask").css('display', 'block');
            $("#orderInvalid").show();
            orderlisttimer = setInterval("orderlist()", 1000);
            clearInterval(paytimer);
            clearInterval(timer);
            }
            }
            var paytime = 60 * 30;
            function payCountDown() {
            if (paytime > 0) {
            --paytime;
            } else {
            $('#fe_window_mask').css('display', 'block');
            $("#paytimeout").show();
            clearInterval(paytimer);
            }
            }
            var timer = setInterval("CountDown()", 1000);
            var paytimer = setInterval("payCountDown()", 1000);
        #payChoices.pay-box
          form#prePayForm(name='prePayForm', method='post', action='https://pay.chuanke.com/st/PrePay?r=1471329526')
            dl
              dd
                .pay-item.clearfix
                  .left-part
                    span.f16(style="font-family:'Microsoft Yahei'") 讲义寄送地址
                  .fl.mt10(style='width: 100%')
                    span.f14(style="font-family:'Microsoft Yahei'") 何慕嘉 江苏 苏州市 常熟市 虞山镇梦兰工业园龙芯梦兰公司 153****0552
                    a#startEditAddress.fr.f12(style='cursor: pointer;') 编辑
                  #editAddress.selectBank.cb(style='padding: 20px 0px 0px; margin:0px;display: block;')
                    .s_bd
                      form.formH.grzlForm.clearfix(action='')
                        .formItem.mb20.pb5.mt20
                          label.form_label 收件人：
                          .form_field
                            input#addressee.form_text.w230(type='text', value='和睦家')
                        // =E formItem
                        .formItem.mb20
                          label.form_label 手机：
                          .form_field
                            input#mobile.form_text(type='text', maxlength='11', value='13571880886')
                        // =E formItem
                        .formItem.mb20
                          label.form_label 所在城市：
                          .form_field
                            span.mr10
                              select#idProvince
                                option(value='0') -
                                option(value='10101000000') 北京市
                            span.mr25
                              select#idCity
                                option(value='10110010000') 南京市
                                option(value='10110020000') 无锡市
                        // =E formItem
                        .formItem.mb20
                          label.form_label 详细地址：
                          .form_field
                            textarea#address(rows='10', cols='30') 常熟市长江路30号
                        .formItem.mb20
                          label.form_label  
                          .form_field
                            p.mb10
                              a#saveAddressBtn.n_btn38g(href='javascript:;') 保存
              dd
                .pay-item.clearfix
                  .left-part
                    span.f16(style="font-family:'Microsoft Yahei'") 优惠券
                  .selectBank.cb(style='padding: 20px 0px 0px; margin:0px;display: block;')
                    .s_bd
                      ul.selectBankBox.clearfix
                        li(name='bankIcon', style='width: 220px;height: 122px')
                          i.check-item.check-coupon
                          i.ico_coupon(title='优惠券1', style='cursor:pointer;')
              dd
                .pay-item.clearfix.checked
                  .left-part
                    i#cardCheck.check-item.check-Obj
                    // 选择状态checked,不可用状态disabled
                    span.check-t 银行卡
                  .mid-part
                    span 网上银行支付
                  .right-part
                    span
                      | 支付
                      i#showPayMoney.c_f60.f20.yahei 10.0
                      | 元
                  // =S 选择银行
                  .selectBank.cb.hide-part(style='padding: 20px 0px 0px; display: block;')
                    .s_bd
                      ul.selectBankBox.clearfix
                        li#bankIcon101.curr(name='bankIcon')
                          input#bankRadio101(type='radio', name='bankId', value='101', checked='checked', onclick="chooseBank('101',false);")
                          i.ico_bank.ico_bank_gongshang(title='中国工商银行', onclick="chooseBank('101',true)", style='cursor:pointer;')
                        li#bankIcon201(name='bankIcon')
                          input#bankRadio201(type='radio', name='bankId', value='201', onclick="chooseBank('201',false);")
                          i.ico_bank.ico_bank_zhaoshang(title='招商银行', onclick="chooseBank('201',true)", style='cursor:pointer;')
                        li#bankIcon301(name='bankIcon')
                          input#bankRadio301(type='radio', name='bankId', value='301', onclick="chooseBank('301',false);")
                          i.ico_bank.ico_bank_jianshe(title='中国建设银行', onclick="chooseBank('301',true)", style='cursor:pointer;')
                        li#bankIcon401(name='bankIcon')
                          input#bankRadio401(type='radio', name='bankId', value='401', onclick="chooseBank('401',false);")
                          i.ico_bank.ico_bank_nongye(title='中国农业银行', onclick="chooseBank('401',true)", style='cursor:pointer;')
                        li#bankIcon501(name='bankIcon')
                          input#bankRadio501(type='radio', name='bankId', value='501', onclick="chooseBank('501',false);")
                          i.ico_bank.ico_bank_zhongxin(title='中信银行', onclick="chooseBank('501',true)", style='cursor:pointer;')
                        
                  // =E 选择银行
              dd
                .pay-item.clearfix
                  .left-part
                    i#underLinePay.check-item.check-Obj
                    span.check-t 线下汇款
                  .right-part
                    span
                      | 支付
                      i.c_f60.f20.yahei 10.0
                      | 元
                  // =S 选择银行
                  .selectBank.cb.hide-part(style='padding: 20px 0px 0px; display: none;')
                    .s_bd
                      ul.selectBankBox.clearfix
                        li#bankIcon333.curr(name='bankIcon')
                          input#bankRadio333(type='radio', name='bankId2', value='101', checked='checked', onclick="chooseBank('101',false);")
                          i.ico_bank.ico_bank_gongshang(title='中国工商银行', onclick="chooseBank('101',true)", style='cursor:pointer;')
                  // =E 选择银行
              dd
                .pay-item.clearfix
                  ul.selectBankBox.clearfix
                    li#thirdIconalipay(name='thirdIcon')
                      input#thirdRadioalipay(type='radio', name='thirdId', value='alipay', onclick="chooseThird('alipay',false);")
                      i.ico_bank.ico_bank_zhifubao(title='支付宝', onclick="chooseThird('alipay',true)", style='cursor:pointer;')
            // =E 选择银行
            .mt20(style='padding-left:90px;')
              a.n_btn40o(href='https://pay.chuanke.com/st/PrePay?r=1471329526#', onclick='prePaySubmit();return false;') 立即付款
              // 不可用状态class添加disabled
              #showError.f12.c_f60.mt5(style='display: none')
              input#moneyError(type='hidden', value='10.00')
    script.
      var check_control = window.check_control || {};
      check_control.addCheck = function (ele) {
      var parents = $(ele).parents('.pay-item');
      $(ele).data('checked', true);
      $(parents).addClass('checked');
      $(parents).children('.hide-part').show();
      }
      check_control.removeCheck = function (ele) {
      var parents = $(ele).parents('.pay-item');
      $(ele).data('checked', false);
      $(parents).removeClass('checked');
      $(parents).children('.hide-part').hide();
      }
      check_control.checked = function (ele) {
      var parents = $(ele).parents('.pay-item');
      console.log("sad")
      if (!$(parents).hasClass('disabled')) {
      if ($(parents).hasClass('checked')) {
      check_control.removeCheck(ele);
      } else {
      check_control.addCheck(ele);
      }
      }
      }
      $("#startEditAddress").click(function () {
      $("#editAddress").show(500);
      })
      $("#saveAddressBtn").click(function () {
      $("#editAddress").hide(500);
      })
      function chooseBank(bankCode, doClick) {
      $("li[name='bankIcon']").removeClass("curr");
      $("#bankIcon" + bankCode).addClass("curr");
      if (doClick) {
      $("#bankRadio" + bankCode).click();
      }
      }
      //$(function(){
      $(".check-Obj").bind("click", function () {
      check_control.removeCheck($("#underLinePay"));
      check_control.removeCheck($("#cardCheck"));
      check_control.checked($(this));
      $("li[name='thirdIcon']").removeClass("curr");
      var radios = document.getElementsByName("thirdId");
      for (var i = 0; i < radios.length; i++) {
      if (radios[i].checked == true) {
      radios[i].checked = false;
      break;
      }
      }
      })
      $(".check-coupon").bind("click", function () {
      check_control.checked($(this));
      })
      //})
      function chooseThird(bankCode, doClick) {
      $("li[name='thirdIcon']").removeClass("curr");
      $("#thirdIcon" + bankCode).addClass("curr");
      if (doClick) {
      $("#thirdRadio" + bankCode).click();
      } else {
      check_control.removeCheck($("#underLinePay"));
      check_control.removeCheck($("#cardCheck"));
      }
      }
